/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2023-04-19
 * Time: 16:28
 */
class MyArray<T> {
    //public T[] objects = new T[10];//ERROR 1、不能实例化泛型类型的数组
    public T[] objects = (T[])new Object[10];
    //public Object[] objects = new Object[10];
     public void set(int pos,T val) {
         objects[pos] = val;
     }

     public T get(int pos) {
         return objects[pos];
     }

     public T[] getArray() {
         return objects;
    }
}
public class TestDemo {
    public static void main(String[] args) {
        MyArray<String> myArray = new MyArray<String>();
        myArray.getArray();

    }
}
